package edu.gatech.oad.antlab.m7final;


/**
 * This is the WagonController Class
 * This class instantiates a new Wagon object based on input from the ConfigPanel
 * @author "It's A Trap!"
 * @version 1.0 10/10/2011
 */
public class WagonController {
	
	private Wagon wagon;
	private Settler settler1, settler2, settler3, settler4;
	private Player player;
	
	/**
	 * Constructor for the WagonController class.
	 * 
	 * @param ration The rations for the party
	 * @param nameArr An array containing all of the settler's names
	 * @param pace The pace of the wagon
	 * @param playerName The name of the player
	 * @param profession The player's profession
	 */
	public WagonController(String ration, String[] nameArr, Pace pace, String playerName, Profession profession){
		configWagon(ration, nameArr, pace, playerName, profession);
	}
	
	/**
	 * This is the configWagon Method.
	 * This method instantiates a new Wagon object with settlers and their rations, and pace
	 * @param ration The rations for the party
	 * @param name An array of the settlers' names
	 * @param wagonPace The pace of the wagon
	 * @param playerName The player's name
	 * @param profession The player's profession
	 */
	public void configWagon(String ration, String[] name, Pace wagonPace, String playerName, Profession profession) {
		settler1 = new Settler(name[0]);
		settler2 = new Settler(name[1]);
		settler3 = new Settler(name[2]);
		settler4 = new Settler(name[3]);
		player = new Player (playerName, profession);
		setWagon(Wagon.getWagon(settler1, settler2, settler3, settler4, wagonPace, player, ration));
	}

	/**
	 * @return the myWagon
	 */
	public Wagon getWagon() {
		return wagon;
	}

	/**
	 * @param myWagon the myWagon to set
	 */
	public void setWagon(Wagon wagon) {
		this.wagon = wagon;
	}
	
	public Settler getSettler1() {
		return settler1;
	}
	
	public Settler getSettler2() {
		return settler2;
	}
	
	public Settler getSettler3() {
		return settler1;
	}
	
	public Settler getSettler4() {
		return settler1;
	}
	
	public Player getPlayer() {
		return player;
	}
	
	public void setSettlerHealth(Settler mySettler, String health){
		if(health.equals("healthy")) 
			mySettler.setHealthy();
		else if (health.equals("ill"))
			mySettler.setIll();
		else
			mySettler.setDead();
	}

	public void setPlayerHealth(Player myPlayer, String health){
		if(health.equals("healthy")) 
			myPlayer.setHealthy();
		else if (health.equals("ill"))
			myPlayer.setIll();
		else
			myPlayer.setDead();
	}
}
